<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    function changeStrUpper(str){
        // 先判断第一个位置是不是-   是的话去掉
        let isHas = str[0] == '-'
        if(isHas){
            str = str.slice(1)
        }
        let res = ''
        // 切割字符串
        let arrStr = str.split('-')
        // 遍历变成大写
        arrStr.forEach((item,index)=>{
            if(index>0){
                let big =  item[0].toUpperCase()
                let res = item.substr(1)
                item = big + res
            }
            res += item
        })
        return res
    }
    // let res = changeStrUpper('-font-size')
    let res = changeStrUpper('font-size')
    console.log(res)
</script>

</body>
</html>
